angular.module('baisonEndDay', ['baisonService'])
        //获取全部支付方式
        .factory('ReceiptFinished', ['apiService', '$q', '$rootScope', function (apiService, $q, $rootScope) {
                var get_receipt_finished = function (ret) {

                    var filter = {
                        shop_code: $rootScope.current_shop.ShopCode,
                        date: ret
                    };
                    return $q.all({
                        'normal': apiService('pos/pos/get_day_settlement', filter),
                        'return': apiService('pos/pos/get_not_day_settlement', filter),
                        'total': apiService('pos/pos/get_day_sell', filter)
                    });
                };
                var submit_receipt_finished = function (ret) {
                    var param = {
                        day: ret.time,
                        shop_code: $rootScope.current_shop.ShopCode,
                        user_code: $rootScope.user.UserCode,
                        remark: ret.summary
                    };
                    return apiService('pos/pos/start_day_settlement', param);
                };
                return {
                    get_receipt_finished: get_receipt_finished,
                    submit_receipt_finished: submit_receipt_finished
                };
            }]);